<!--
 * @Author: your name
 * @Date: 2020-03-10 16:26:49
 * @LastEditTime: 2020-03-10 17:32:45
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \pingou\template\default\member\withdraw\weixinpayAdd.html
 -->
{extend name="layouts@base" /}
{block name="head"}
<link rel="stylesheet" href="__STATIC__/mobile/default/css/userData.css" />
{/block}

{block name="main" }
<form id="weixinpay_from">
  <div class="page-bd">
    <!-- 页面内容-->
    <div class="cells">
      <div class="cell">
        <div class="cell_hd"><span class="fs28 color_3 fw_b">账户姓名</span></div>
        <div class="cell_bd">
          <input type="text" class="fs28  color_3" name="weixinpay_user_name" placeholder="请输入账户姓名">
        </div>
      </div>
      <div class="cell">
        <div class="cell_hd"><span class="fs28 color_3 fw_b">微信账号</span></div>
        <div class="cell_bd">
          <input type="text" class="fs28  color_3" name="weixinpay_account" placeholder="请输入微信账号">
        </div>
      </div>
      <div class="cell cell_auto">
        <div class="cell_hd"><span class="fs28 color_3 fw_b">收款二维码</span></div>
        <div class="cell_bd">
          <div class="uploader">
            <img src="" alt="" class="userimg" style="position: absolute;z-index: 1;max-width: 100%;max-height: 100%;">
            <input type="file" accept="image/jpeg,image/jpg,image/png" class="uploadInput" onchange="uploadFile(this,event)"
              style="width:100%;height:100%;opacity:0;">
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="page-ft">
    <span class="fs32 color_w fw_b BGcolor_r postBtn">确认添加</span>
  </div>
  </div>


  </div>
</form>
{/block}

{block name="footer"}
<script>

  var img_url = ''

  //选择上传图片
  function uploadFile(_this, e) {
    compress(e, function (base64Img) {
      img_url = base64Img
      $('.userimg').attr('src', base64Img);
    })
  }



  $('.postBtn').click(function () {
    var arr = $('#weixinpay_from').toJson();
    arr.img_url = img_url

    if (arr.weixinpay_user_name == '') {
      _alert('请输入账户姓名.');
      return false;
    }
    if (arr.weixinpay_account == '') {
      _alert('请输入支付宝账号.');
      return false;
    }
    if (arr.img_url == '') {
      _alert('请输入支付宝账号.');
      return false;
    }

    jq_ajax('{:url("member/api.withdraw/weixinPayAdd")}', arr, function (res) {
      if (res.code == 0) {
        _alert(res.msg);
        return false;
      }
      window.location.href = '{:url("withdraw/banklist")}';
    });

  })
</script>
{/block}